<template>
	<uv-tabbar :value="tabbarIndex" zIndex="999" iconSize="25" :fixed="true" inactiveColor="#ffffff" activeColor="#dc9f37" :customStyle="{'background':'#581107'}"  @change="change">
		<uv-tabbar-item :text="item.text" :icon="props.index == index ? item.iconAcitve : item.icon" v-for="(item,index) in tabbarList" :key="index"></uv-tabbar-item>
	</uv-tabbar>
</template>
<script setup lang="ts">
import { ref , defineProps , withDefaults} from 'vue'
import indexIcon from '@/static/home.png'
import indexIconActive from '@/static/home_select.png'
import movieIcon from '@/static/movie.png'
import movieIconActive from '@/static/movie_select.png'
import trophyIcon from '@/static/trophy.svg'
import trophyIconActive from '@/static/trophyActive.svg'
import mineIcon from '@/static/mine.png'
import mineIconActive from '@/static/mine_select.png'
import citycard from '@/static/cinema.svg'
import citycardActive from '@/static/cinemaActive.svg'
interface Props {
  index: number,
}
const props = withDefaults(defineProps<Props>(), {
    index: 0
})

const tabbarIndex = ref<any>(props.index * 1)
const tabbarList = [
    {text:'首页',pageUrl:'/pages/index/index',icon:indexIcon,iconAcitve:indexIconActive},
    {text:'影院',pageUrl:'/pages/movie/index',icon:movieIcon,iconAcitve:movieIconActive},
    //{text:'影城展示',pageUrl:'',icon:citycard,iconAcitve:citycardActive},///pages/newLine/index
    //{text:'拼团',pageUrl:'',icon:trophyIcon,iconAcitve:trophyIconActive},///pages/newLine/milestones
    {text:'我的',pageUrl:'/pages/mine/index',icon:mineIcon,iconAcitve:mineIconActive},
]
const change = (index : any) => {
    // tabbarIndex.value = index
	
	
    const item = tabbarList[index]
	console.log("index1", index)
	console.log("tabbarList",tabbarList)
    if(item.pageUrl){
        // uni.switchTab({
        //     url: item.pageUrl
        // });
		uni.reLaunch({
		  url: item.pageUrl
		})
    }else uni.showToast({icon:'none',title:`${item.text}还未开放，敬请期待`})
}
</script>
<style scoped lang="scss">
	.icon {
		width: 36rpx;
		height: 36rpx;
	}
</style>